function Rectangle(name, width, height) {
  this.name = name;
  this.width = width;
  this.height = height;
  this.area = function () {
    return this.width * this.height;
  };
}
const rect1 = new Rectangle("矩形 1", 20, 20);
const rect2 = new Rectangle("矩形 2", 30, 20);
console.log(rect1.name); // 输出：矩形 1
console.log(rect2.width); // 输出：30
console.log(rect1["width"]); // 输出：20
rect1.color = "红⾊";
console.log(rect1);
rect2.perimeter = function () {
  return 2 * (rect2.width + rect2.height);
 };
 console.log(rect2.perimeter()); // 输出：10
 console.log(rect2);
delete rect2.perimeter;
console.log(rect2);
console.log(rect1.hasOwnProperty("color")); // 输出：true
console.log(rect2.hasOwnProperty("color")); // 输出：false
console.log(Object.keys(rect1));
// 输出：[ 'name', 'width', 'height', 'area', 'color' ]
console.log(Object.values(rect2));
// 输出：[ '矩形 2', 30, 20, [Function: area] ]
console.log(Object.entries(rect1));
for (let [key, value] of Object.entries(rect1)) {
  console.log(`${key} - ${value}`);
}
for (let [key, value] of Object.entries(rect1)) {
  console.log(`${key} - ${value}`);
} 
for (let [key, value] of Object.entries(rect1)) {
  if (typeof value !== "function") {
  console.log(`${key} - ${value}`);
  }
 }
function Rectangle(name, width, height) {
  this.name = name;
  this.width = width;
  this.height = height;
 }
const rect = new Rectangle("矩形 1", 20, 20);
console.log(rect);
console.log(rect.__proto__);
console.log(rect.__proto__.constructor);
const arr = [];
console.log(arr.__proto__);
const str = new String("Hello");
console.log(str.__proto__);
// 输出：String.prototype
console.log(Object.getPrototypeOf(rect));
// 输出：{ constructor: [Function: Rectangle] }